//
//  MYAFNetworking.h
//  QA
//
//  Created by Yoga on 2017/4/25.
//  Copyright © 2017年 ZDQK. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface MYAFNetworking : NSObject

/**
 带缓存的POST请求
 
 @param URLString 地址
 @param parameters 传递参数
 @param success 成功
 @param failure 失败
 @param isNeed 是否需要缓存
 */
+ (void)POST:(NSString *_Nullable)URLString
  parameters:(id _Nullable )parameters
     success:(void (^_Nullable)(NSURLSessionDataTask *_Nullable task, id _Nullable responseObject))success
     failure:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, NSError *_Nullable error))failure
 isNeedCache:(BOOL)isNeed;

/**
 *  POST 请求
 */
+ (void)POST:(NSString *_Nullable)URLString
  parameters:(id _Nullable )parameters
     success:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
     failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error))failure;



+ (void)POST:(NSString *_Nullable)URLString
  parameters:(id _Nullable )parameters
     baseUrl:(NSString *)baseUrl
     success:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
     failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error))failure;


/**
 POST 普通请求

 @param URLString 请求URL
 @param parameters 参数
 @param success 成功回调
 @param failure 失败回调
 */
+ (void)POSTNormal:(NSString * _Nullable)URLString
        parameters:(id _Nullable)parameters
           success:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
           failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error))failure;

/**
 GET 普通请求

 @param URLString 请求URL
 @param parameters 参数
 @param success 成功回调
 @param failure 失败回调
 */
+ (void)GETNormal:(NSString * _Nullable)URLString
       parameters:(id _Nullable)parameters
          success:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
          failure:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error))failure;

/**
 *  GET 请求
 */
+ (void)GET:(NSString *_Nullable)URLString
 parameters:(id _Nullable )parameters
    success:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
    failure:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error))failure;

/**
 *  @brief  单图上传
 */
+ (void)UPLoad:(NSString *_Nullable)URLString
        images:(id _Nullable )image
      progress:(nullable void (^)(NSProgress * _Nonnull))progress
       success:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
       failure:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error))failure;

/**
 *  @brief  多图上传
 */
+ (void)Upload:(NSString *_Nullable)url
       Imagess:(id _Nullable )imageArray
       success:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject,NSString * _Nullable imageUrl ))success
       failure:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error))failure;

/**
 *  单文件上传
 */
+ (void)uploadfileUrl:(NSString *_Nullable)url
          filePath:(NSString *_Nullable)filePath
          progress:(void (^_Nullable)(NSProgress * _Nonnull uploadProgress))progress
           success:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject,NSString * _Nullable fileUrl ))success
           failure:(void (^_Nullable)(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error))failure;


// 先保留2个
+ (NSURLSessionDownloadTask *_Nullable)downloadTaskWithRequest:(NSString *_Nullable)request
                                             completionHandler:(void (^_Nullable)(NSURLResponse * _Nullable response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler;

+ (NSString*_Nullable)DataTOjsonString:(id _Nullable )object;
+ (NSDictionary *_Nullable)dictionaryWithJsonString:(NSString *_Nullable)jsonString;

@end
